#include<stdio.h>
#include<unistd.h>
#include<string.h>
#include<stdlib.h>
enum                              //自定义枚举类型，Success=0，整除Div_Zero,取模Mod_Zero
{
	Success = 0,                  //成功状态，对应数值0
	Div_Zero,                     //除0错误，对应数值1
	Mod_Zero,                     //取模错误，对应数值2
};

int exit_code = Success;          //退出码默认是成功的。

const char* CodeToErrString(int code)  //输出错误信息
{
	switch(code)
	{
		case Success:
			return "Success!";
		case Div_Zero:
			return "div zero!";
		case Mod_Zero:
			return "mod zero!";
		default:
			return "unknow erro!";
	}
}

int Div(int x, int y)
{	
	_exit(13);
}

int main()
{
	int result = Div(10,2);
	printf("result: %d, CodeToErrString(): %s\n ",result,CodeToErrString(exit_code));

}
